package ${packageName}.pojo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.validation.constraints.NotNull;

<#if plugin.enableLombok>
    import lombok.AllArgsConstructor;
    import lombok.Data;
    import lombok.NoArgsConstructor;
</#if>
<#if plugin.enableMybatisplus>
    import com.baomidou.mybatisplus.annotation.IdType;
    import com.baomidou.mybatisplus.annotation.TableId;
    import com.baomidou.mybatisplus.annotation.TableName;

</#if>
<#if plugin.enableSwagger>
    import io.swagger.annotations.ApiModel;
    import io.swagger.annotations.ApiModelProperty;
</#if>

/**
* ${remarksTable}
*/
<#if plugin.enableLombok>
    @NoArgsConstructor// 创建无参的构造方法
    @AllArgsConstructor// 创建满参的构造方法
    @Data
</#if>
<#if plugin.enableMybatisplus>
    @TableName("${tableName}")
</#if>
<#if plugin.enableSwagger>
    @ApiModel(description = "${remarksTable}")
</#if>
public class ${modelName} implements Serializable{
private static final long serialVersionUID = 1L;
<#if columns??>
    <#list columns as column>
        /**
        * ${column.remark}
        */
        <#if column.isNullable='NO'>
            @NotNull
        </#if>
        <#if plugin.enableSwagger>
            @ApiModelProperty("${column.remark}")
        </#if>
        <#if column.type=='BIGINT'>
            <#if column.isPrimary=='true' && plugin.enableMybatisplus>
                <#if column.isAutoincrement=='YES'>
                    @TableId(value = "${column.columnName}", type = IdType.AUTO)//自增
                <#else >
                    @TableId(value = "${column.columnName}", type = IdType.ASSIGN_ID)//使用雪花算法
                </#if>
            </#if>
            @JsonSerialize(using= ToStringSerializer.class)//解决long 过长 json 精度丢失
            private Long ${column.propertyName?uncap_first};
        <#elseif column.type=='DATE'>
            @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
            @DateTimeFormat(pattern="yyyy-MM-dd")
            private ${column.javaType} ${column.propertyName?uncap_first};
        <#else >
            <#if column.isPrimary=='true' && plugin.enableMybatisplus>
                <#if column.isAutoincrement=='YES'>
                    @TableId(value = "${column.columnName}", type = IdType.AUTO)//自增
                <#else >
                    @TableId(value = "${column.columnName}", type = IdType.INPUT)//手动输入
                </#if>
            </#if>
            private ${column.javaType} ${column.propertyName?uncap_first};
        </#if>



    </#list>
</#if>

}